Skip to content

support modern header footer#1691

Open
czullu wants to merge 5 commits intopnp:devfrom
MondayCoffee:1690_SupportModernHeaderFooter
Open

support modern header footer#1691
czullu wants to merge 5 commits intopnp:devfrom
MondayCoffee:1690_SupportModernHeaderFooter

Conversation

@czullu
Copy link
Copy Markdown

@czullu czullu commented Sep 7, 2025

@jansenbe implementation of #1690
Support for new Header and Footer settings
Support to Get available fonts in Branding Manager from Site, OutOfBox, Branding Center (Organization)
Support to Set Font to Site in Branding Manager for OutOfBox and Branding Center Fonts (Organization)

The Chrome properties are reflected as WebProperties:
"HeaderOverlayColor",
"HeaderOverlayOpacity",
"HeaderOverlayGradientDirection",
"HeaderColorIndexInLightMode",
"HeaderColorIndexInDarkMode",
"FooterAlignment",
"FooterOverlayColor",
"FooterOverlayOpacity",
"FooterOverlayGradientDirection",
"FooterColorIndexInLightMode",
"FooterColorIndexInDarkMode",
"FontOptionForSiteTitle",
"FontOptionForSiteNav",
"FontOptionForSiteFooterTitle",
"FontOptionForSiteFooterNav",
"FooterBackgroundImageUrl",
"FooterBackgroundImageFocalPoint",
"BackgroundImageUrl"

But have to be set as /_api/web/SetChromeOptions
{
"headerLayout": 4,
"headerEmphasis": 2,
"megaMenuEnabled": true,
"footerEnabled": true,
"footerLayout": 0,
"footerEmphasis": 0,
"hideTitleInHeader": false,
"logoAlignment": 1,
"footerAlignment": 0,
"footerOverlayColor": -1,
"footerOverlayOpacity": 0,
"footerOverlayGradientDirection": 0,
"headerOverlayColor": 1,
"headerOverlayOpacity": 54,
"headerOverlayGradientDirection": 0,
"fontOptionForSiteTitle": null,
"fontOptionForSiteNav": null,
"fontOptionForSiteFooterTitle": null,
"fontOptionForSiteFooterNav": null,
"horizontalQuickLaunch": true,
"headerColorIndexInLightMode": -1,
"headerColorIndexInDarkMode": -1,
"footerColorIndexInLightMode": -1,
"footerColorIndexInDarkMode": -1
}

christian zuellig added 5 commits September 5, 2025 17:15
"HeaderOverlayColor",
"HeaderOverlayOpacity",
"HeaderOverlayGradientDirection",
"HeaderColorIndexInLightMode",
"HeaderColorIndexInDarkMode",
"FooterAlignment",
"FooterOverlayColor",
"FooterOverlayOpacity",
"FooterOverlayGradientDirection",
"FooterColorIndexInLightMode",
"FooterColorIndexInDarkMode",
"FontOptionForSiteTitle",
"FontOptionForSiteNav",
"FontOptionForSiteFooterTitle",
"FontOptionForSiteFooterNav",

still to be implemented:
"FooterBackgroundImageUrl",
"FooterBackgroundImageFocalPoint",
"BackgroundImageUrl"
- set footer background image
- get fonts from site, branding center and OutOfTheBox

Open
- set font by id
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Sep 8, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.25%. Comparing base (63545f3) to head (52ee035).
⚠️ Report is 2892 commits behind head on dev.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1691      +/-   ##
==========================================
- Coverage   82.42%   81.25%   -1.17%     
==========================================
  Files         416      637     +221     
  Lines       28590    45266   +16676     
  Branches        0     4750    +4750     
==========================================
+ Hits        23565    36783   +13218     
- Misses       5025     7087    +2062     
- Partials        0     1396    +1396     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the SharePoint branding/chrome APIs in PnP.Core to support the newer “modern” header/footer options (overlay colors/opacity/gradient direction, color indexes, footer alignment), adds support for site font chrome configuration, and introduces APIs to list/apply available font packages (OOB, site, branding center).

Changes:

  • Added new enums and properties to represent modern header/footer overlay settings and footer link alignment.
  • Added font chrome models (IFontOptions / IFontOption) and wired them into chrome get/set flows.
  • Added IBrandingManager APIs and internal implementation to list/apply font packages and to support footer background images.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 15 comments.

Show a summary per file
File Description
src/sdk/PnP.Core/Model/SharePoint/Core/Public/Enums/OverlayGradientDirectionType.cs Adds gradient direction enum for overlay options.
src/sdk/PnP.Core/Model/SharePoint/Core/Public/Enums/OverlayColorType.cs Adds overlay color enum used by header/footer chrome.
src/sdk/PnP.Core/Model/SharePoint/Core/Public/Enums/FooterLinkAlignment.cs Adds footer link alignment enum for modern footer.
src/sdk/PnP.Core/Model/SharePoint/Branding/Public/IHeaderOptions.cs Exposes new modern header overlay/color index properties.
src/sdk/PnP.Core/Model/SharePoint/Branding/Public/IFooterOptions.cs Exposes new modern footer overlay/alignment properties + footer background image APIs.
src/sdk/PnP.Core/Model/SharePoint/Branding/Public/IFontPackage.cs Introduces font package model for font package endpoints.
src/sdk/PnP.Core/Model/SharePoint/Branding/Public/IFontOptions.cs Introduces site font chrome configuration contract.
src/sdk/PnP.Core/Model/SharePoint/Branding/Public/IFontOption.cs Introduces font option contract used in chrome payload.
src/sdk/PnP.Core/Model/SharePoint/Branding/Public/IChromeOptions.cs Adds Font section to chrome options.
src/sdk/PnP.Core/Model/SharePoint/Branding/Public/IBrandingManager.cs Adds public APIs for listing/applying font packages.
src/sdk/PnP.Core/Model/SharePoint/Branding/Internal/HeaderOptions.cs Implements new header overlay properties; relaxes header background-image restriction.
src/sdk/PnP.Core/Model/SharePoint/Branding/Internal/FooterOptions.cs Implements new footer overlay properties + footer background-image support.
src/sdk/PnP.Core/Model/SharePoint/Branding/Internal/FontPackage.cs Internal implementation for IFontPackage.
src/sdk/PnP.Core/Model/SharePoint/Branding/Internal/FontOptions.cs Internal implementation for IFontOptions.
src/sdk/PnP.Core/Model/SharePoint/Branding/Internal/FontOption.cs Internal implementation for IFontOption.
src/sdk/PnP.Core/Model/SharePoint/Branding/Internal/Enums/SiteLogoType.cs Adds FooterBackground site logo type for SiteIconManager calls.
src/sdk/PnP.Core/Model/SharePoint/Branding/Internal/ChromeOptions.cs Wires Font options into internal chrome options model.
src/sdk/PnP.Core/Model/SharePoint/Branding/Internal/BrandingManager.cs Loads modern chrome values from AllProperties, serializes them into SetChromeOptions payload, and adds font package endpoints support.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 29 to +54
public LogoAlignment LogoAlignment { get; set; }

/// <summary>
/// Specifies the available overlay color types that can be applied to header or footer.
/// </summary>
public OverlayColorType OverlayColor { get; set; }

/// <summary>
/// Gets or sets the opacity level of the overlay [0-100].
/// </summary>
public int OverlayOpacity { get; set; }

/// <summary>
/// Defines the possible directions for an overlay gradient layout.
/// </summary>
public OverlayGradientDirectionType OverlayGradientDirection { get; set; }

/// <summary>
/// seesm to be alays -1
/// </summary>
public int ColorIndexInLightMode { get; set; }

/// <summary>
/// seesm to be alays -1
/// </summary>
public int ColorIndexInDarkMode { get; set; }
Comment on lines +47 to +52
/// seesm to be alays -1
/// </summary>
public int ColorIndexInLightMode { get; set; }

/// <summary>
/// seesm to be alays -1
Comment on lines +153 to +157
// => modern Header does allow background images for all layouts
//if (Layout != HeaderLayoutType.Extended)
//{
// throw new ClientException(ErrorType.Unsupported, PnPCoreResources.Exception_Unsupported_BackgroundImageHeaderIsNotOfTypeExtended);
//}
Comment on lines 27 to +34
public string DisplayName { get; set; }

public FooterLinkAlignment LinkAlignment { get; set; }
public OverlayColorType OverlayColor { get; set; }
public int OverlayOpacity { get; set; }
public OverlayGradientDirectionType OverlayGradientDirection { get; set; }
public int ColorIndexInLightMode { get; set; }
public int ColorIndexInDarkMode { get; set; }
Comment on lines +46 to +51
/// seesm to be alays -1
/// </summary>
int ColorIndexInLightMode { get; set; }

/// <summary>
/// seesm to be alays -1
Comment on lines +539 to +560
if (web.AllProperties.Values.TryGetValue("FontOptionForSiteTitle", out var FontOptionForSiteTitle)
| web.AllProperties.Values.TryGetValue("FontOptionForSiteNav", out var FontOptionForSiteNav)
| web.AllProperties.Values.TryGetValue("FontOptionForSiteFooterTitle", out var FontOptionForSiteFooterTitle)
| web.AllProperties.Values.TryGetValue("FontOptionForSiteFooterNav", out var FontOptionForSiteFooterNav))
{
if(!string.IsNullOrWhiteSpace(FontOptionForSiteTitle?.ToString()))
{
chromeOptions.Font.SiteTitle = JsonSerializer.Deserialize<FontOption>(FontOptionForSiteTitle.ToString());
}
if (!string.IsNullOrWhiteSpace(FontOptionForSiteNav?.ToString()))
{
chromeOptions.Font.SiteNav = JsonSerializer.Deserialize<FontOption>(FontOptionForSiteNav.ToString());
}
if (!string.IsNullOrWhiteSpace(FontOptionForSiteFooterTitle?.ToString()))
{
chromeOptions.Font.SiteFooterTitle = JsonSerializer.Deserialize<FontOption>(FontOptionForSiteFooterTitle.ToString());
}
if (!string.IsNullOrWhiteSpace(FontOptionForSiteFooterNav?.ToString()))
{
chromeOptions.Font.SiteFooterNav = JsonSerializer.Deserialize<FontOption>(FontOptionForSiteFooterNav.ToString());
}
}
Comment on lines +689 to 695
footerColorIndexInLightMode = chromeOptions.Footer != null ? chromeOptions.Footer.ColorIndexInLightMode : -1,
footerColorIndexInDarkMode = chromeOptions.Footer != null ? chromeOptions.Footer.ColorIndexInDarkMode : -1,
fontOptionForSiteTitle = chromeOptions.Font != null ? chromeOptions.Font.SiteTitle : null,
fontOptionForSiteNav = chromeOptions.Font != null ? chromeOptions.Font.SiteNav : null,
fontOptionForSiteFooterTitle = chromeOptions.Font != null ? chromeOptions.Font.SiteFooterTitle : null,
fontOptionForSiteFooterNav = chromeOptions.Font != null ? chromeOptions.Font.SiteFooterNav : null,
};
Comment on lines +819 to +836
public async Task<List<IFontPackage>> GetOutOfBoxFontPackagesAsync()
{
var batch = context.NewBatch();
var fontPackages = await GetOutOfBoxFontPackagesBatchAsync(batch).ConfigureAwait(false);
await context.ExecuteAsync(batch).ConfigureAwait(false);
return fontPackages.Result;
}

public List<IFontPackage> GetOutOfBoxFontPackages()
{
return GetOutOfBoxFontPackagesAsync().GetAwaiter().GetResult();
}

public async Task<IBatchSingleResult<List<IFontPackage>>> GetOutOfBoxFontPackagesBatchAsync(Batch batch)
{
ApiCall apiCall = BuildGetOutOfBoxFontPackagesApiCall();
return await GetFontPackagesBatchAsync(batch, apiCall).ConfigureAwait(false);
}
Comment on lines +4 to +15
/// specifies the alignment of links in the footer
/// </summary>
public enum FooterLinkAlignment
{
/// <summary>
/// Right alignment ( Value = 0 )
/// </summary>
Right = 0,
/// <summary>
/// Left alignment ( Value = 2 )
/// </summary>
Left = 2,
Comment on lines +16 to +34
/// <summary>
/// dont show this font in the font picker
/// </summary>
bool IsHidden { get; set; }

/// <summary>
/// IsValid
/// </summary>
bool IsValid { get; set; }

/// <summary>
/// json-string containg settings for the font package
/// </summary>
string PackageJson { get; set; }

/// <summary>
/// 0 = Branding Center, 1 = out of the box font
/// </summary>
int Store { get; set; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New Web Site Header / Footer settings - Feature MC1098935

4 participants